//
//  VRSerachResultController.m
//  testForAreacode
//
//  Created by Veer on 16/4/20.
//  Copyright © 2016年 Veer. All rights reserved.
//

#import "YAYISerachResultController.h"
 
@interface YAYISerachResultController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation YAYISerachResultController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = YAYIColorAlpha(200, 200, 200, 0.8);
    
    
    UISearchBar *searchBar = [[UISearchBar alloc] init];
    searchBar.frame = CGRectMake(0, 0, SCREEN_width, 44);
    [[[[searchBar.subviews objectAtIndex:0] subviews] objectAtIndex : 0] removeFromSuperview];
    searchBar.placeholder = @"搜索";
//    searchBar.delegate = self;
    [self.view addSubview:searchBar];
//    self.searchBar = searchBar;
    
    [self setupTableView];
    [self.tableView reloadData];
}



- (void)setupTableView
{
    UITableView *tableView = [[UITableView alloc] init];
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
    self.tableView = tableView;
    tableView.frame = CGRectMake(0, 44, SCREEN_width, SCREEN_height);
//    tableView.mj_h = SCREEN_height - 64;
    
    self.tableView.backgroundColor = YAYIColorAlpha(0, 0, 0, 0);
    self.tableView.tableFooterView = [[UIView alloc] init];
    
    
}


//- (void)showHistory
//{
//    NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
//    [userDef arrayForKey:VRSearchHistoryKey];
//}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *id = @"cellid";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:id];
    if (nil == cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:id];
    }
    cell.backgroundColor = [UIColor whiteColor];
    cell.textLabel.text = @"ddd";
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{

}

@end
